//统一管理项目前部的接口
import requests from "./requests";
import mockRequests from './mockrequests'

// 三级联动接口
// /api/product/getBaseCategoryList  get 无参数

export const reqCategoryList = ()=>{
    // 发送请求:axios发请求返回结果Promise对像
   return requests({url:'/product/getBaseCategoryList',method:'get'});

}

// 获取banner-home轮播图接口

// export const reGetBannerList = ()=>{
//     return mockRequests({url:'/banner',method:'get'});
// }

export const reGetBannerList = ()=>mockRequests.get('/banner');

// 获取floor数据
export const reqFloorList = ()=>mockRequests.get('/floor');

// 获取搜索模块数据 地址：/api/list/  请求方式：post  需要带参数
// 当前这个接口，给服务器传递参数params，至少是一个空对象
export const  reqGetSearchInfo = (params)=>requests({url:"/list", method:"post",data:params})
// export const  reqGetSearchInfo = (params)=>mockRequests({url:"https://mock.presstime.cn/mock/629df60b1a23490028bcaf5e/api/list", method:"post",data:params})

// 获取产品详情信息的接口
export const reqGoodsInfo = (skuid)=>requests({url:`/item/${skuid}`,method:'get'});

// 将产品添加到购物车中 (获取更新产品的个数) /api/cart/addToCart/{ skuId }/{ skuNum }
export const reqAddOrUpdateCart = (skuid,skuNum)=>requests({url:`/cart/addToCart/${skuid}/${skuNum}`,method:'post'});


// 获取购物车列表数据接口
export const reqCartList = () => requests({url:'/cart/cartList',method:'get'})

// 删除购物车接口 /api/cart/deleteCart/{skuId} method:DELETE
export const reqDeleteCartById = (skuid) =>requests({url:`/cart/deleteCart/${skuid}`,method:'delete'})

//修改某一个商品的勾选的状态

export const reqUpdateChecked=(skuid,isChecked)=>requests({url:`/cart/checkCart/${skuid}/${isChecked}`,method:'get'});

//获取用户地址信息
export const reqAddressInfo = ()=>requests({url:`/user/userAddress/auth/findUserAddressList`,method:'get'});

// /获取商品清单数据
export const reqShopInfo = ()=>requests({url:`/order/auth/trade`,method:'get'});

// /提交订单接口
export const reqSubmitOrder = (tradeNo,data)=>requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,method:'post',data});


// 获取验证码发送请求
// /api/user/passport/sendCode/{phone}

export const reqGetCode = (phone)=>requests({url:`/user/passport/sendCode/${phone}`,method:"get"})

// 注册接口
// /api/user/passport/register  method:post phone code password
export const reqUserRegister =(data)=>requests({url:'/user/passport/register',data,method:"post"})

// 登录接口
// /api/user/passport/login method:post  phone password
export const reqUserLogin = (data)=>requests({url:'/user/passport/login',data,method:"post"})

//获取用户信息 /api/user/passport/auth/getUserInfo

export const reqUserInfo = ()=>requests({url:`/user/passport/auth/getUserInfo`,method:'get'});

// 退出登录 /api/user/passport/logout  get

export const reqLogout = ()=>requests({url:'/user/passport/logout',method:'get'})


//获取支付信息接口
export const reqPayInfo = (orderId)=>requests({url:`/payment/weixin/createNative/${orderId}`,method:'get'});

//查询支付结果
export const reqPayStatus = (orderId)=>requests({url:`/payment/weixin/queryPayStatus/${orderId}`,method:'get'});